home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software 2000
/
Software 2000 Volume 1 (Disc 1 of 2).iso
/
utilities
/
u267.dms
/
u267.adf
/
README.SECOND
< prev
next >
Wrap
Text File
|
1978-01-07
|
6KB
|
198 lines
GNU C for the Amiga
===================
History
-------
GNU C (GCC) is a freely-distributable compiler which has been ported
to the Amiga. The present release is 1.37; GCC has moved on to at
least 1.40, but 1.37 seems very reliable. I haven't seen any wrong
code generated yet.
The system is very large. You need a hard drive and lots of RAM (I
have a fully populated A590 and 512k clock expansion, making 3 Mb in
all, which is comfortable most of the time).
The first time I came across it was when Richard Harrison (tricky@cix)
uploaded it in November 1990. At that time it came with the PDC
Libraries, which were in a far from satisfactory state. Also, the
Assembler GAS outputs Sun-format object files; these had to be
converted to Amiga (BLink) format by a utility SObjA, a process
which was complicated by a particular construct in the object files
that wasn't recognised by BLink.
The first task was to get the libraries sorted out. I have tried to
make them as 'standard' as possible; this means that functions in the
Standard C libraries (see, for example, Kernighan & Ritchie, second
edition) do by and large what they should, if they're there at all.
I've included in <system.h> a set of functions which you might call
'generic UNIX', for which my bible has been SunOS. In general, if the
function's supported, it's in the headers; if not, not.
I also had to produce ARP.LIB (the stubs for ARP.LIBRARY); most
compilers, for example Lattice, use `pragmas' so that the compiler
can generate the right code in-line. The nearest to this for GCC is
to use `inline assembler', and you can see a (long) example of this
in the include file <arpfunctions.inline.h>, but it's not always
convenient to include about 100 extra functions in your compilation!
The second task was to attempt to eliminate SObjA. Richard supplied
me with the sources for GCC (the GNU front-end), LD (the Linker),
AR (the Librarian) and others. LD had already been partially changed
by Markus Wild and Richard to output Amiga executables, but there
was a fair bit of tweaking still to do. I also had to generate the
equivalent of ARP.LIB and AMIGA.LIB (the stubs to enable C to call
Operating System code from libraries), which involved processing
all the .fd files in the FD1.3 drawer using a set of GAWK scripts ..
but that's another story.
The libraries are now in a stable and usable state, at any rate if your
interests are like mine: porting utilities and general infrastructure
software. (I realise this is somewhat incestuous! takes all sorts ..)
The software ported so far includes GAWK, SED, OBJDUMP, NM, GCC, LD,
AR, the MAKE from a middle-age Fish Disk, my own GREP, DIFF. Usually
the problems arise from the software itself; the Free Software
Foundation is on occasion very casual about the standard of software
it produces from the maintainability viewpoint. A function prototype
is a rare beast indeed. The source file for ld is more than 7000 lines,
I intended to split it up but telling which bits went together had me
beat.
Setup
-----
The full distribution (to be available, I hope, on a PD disk near you
soon) consists of:
bin9110a.lzh the executables, to go in bin/
lib9110b.lzh the libraries/startup files, to go in lib/
inc9110b.lzh the includes, to go in include/ (I wish I could put
in the Amiga headers for you, but they're (c) C= )
doc9110b.lzh such documentation as I have access to, not always
in the most readable of forms (raw TEX), release
history, and other notes.
I Assign the logical name GCC: to the location on my A590 where I
keep GCC. The listing below is the script GCC:Startup that sets up
the environment (in the doc archive):
-----------------------------------------------------XO
; GCC:Startup
; This is a script for setting up the GCC front end.
; GCC:bin contains cc, cpp, cc1, gas, ld, ar, objdump, nm
; GCC:lib contains startups, libraries
; GCC:include contains system include files
Assign GCC: Applications:gcc ; Applications: is a partition
; The following sets up the standard include directories - amiga_include
; is *not* included in this distribution, because it is (c) C=.
; If you don't do this, cpp searches gnu_gxx_include:, gnu_cc_include:,
; and include: (and you'll get the odd requester for them).
SetEnv GCC_INCLUDES "-I gcc:include -I gcc:amiga_include"
; *NOTE* Do not assign the temporary area (TMPDIR) to the ramdisc unless
; you've got at least 3Mb (otherwise you'll probably run out of memory)
SetEnv TMPDIR "T:"
; final setup: add to path ..
Path GCC:bin add
; alias gcc ..
Alias cc gcc
; bump stack (GNU software is a bit stack-happy)
Stack 131072
; ready to roll ..
------------------------------------------XO
First Steps
-----------
The simplest use of GCC, , to compile `foo.c' and generate the
executable file `foo', is
> gcc foo.c
Beyond that, GCC has a fairly standard set of controlling options. The
full set are in the file gcc.texinfo in the `doc' archive, but a
useful subset is:
General:
-------
-o file output is file.
-v be verbose.
Compilation:
-----------
-c compile only (default is to attempt to link as well).
-O optimise.
-D def define def.
-I loc add loc to front of standard include locations
(see Startup above).
-Q be unquiet (list functions as compiled).
Linking:
-------
-l lib add the library liblib.a to the input to ld at the
point in the sequence of object files implied by
its position in the sequence of source and object
files given.
-L loc add loc to the standard library locations (just
gcc:lib at present).
-s include symbols in the executable (not a lot of
use at the moment).
Changes from standard cc:
------------------------
o Default output executable filename is the filename of
the first object file with all back to the first period
stripped (if no period, a.out).
o -s is inverted as it's passed to ld, so you say -s to
request symbols rather than to strip them.
Finis
-----
Best of luck to all of you!
Simon Wright, 5 October 1991
sjwright@cix.compulink.co.uk
+44(0)329-280835
22 Somervell Drive
Fareham
PO16 7QG
United Kingdom